import request from "@/utils/request";

//登陆
export function login(data) {
  return request({
    url: "/sysUser/login",
    method: "post",
    data
  });
}
//修改密码
export function editUserPwd(data) {
  return request({
    url: "/sysUser/changePwd",
    method: "post",
    data
  });
}
//退出
export function logout() {
  return request({
    url: "/sysUser/logout",
    method: "PUT"
  });
}
//个人信息及权限
export function getMine() {
  return request({
    url: "/sysUser/mine",
    method: "get"
  });
}
//获取角色下拉
export function getAllUser() {
  return request({
    url: "/sysUser/findAllIdAndName",
    method: "post"
  });
}
//角色id获取用户列表
export function roleIdGetUserSelect(roleId) {
  return request({
    url: `/sysUser/findByRoleId/${roleId}`,
    method: "get"
  });
}
//获取角色下拉
export function getAllRole() {
  return request({
    url: "/sysRole/findAllIdAndName",
    method: "post"
  });
}
//获取职位下拉
export function getAllPosition() {
  return request({
    url: "/sysPosition/findPositionList",
    method: "post"
  });
}
//获取部门
export function getAllDepartment() {
  return request({
    url: "/sysDept/tree",
    method: "get"
  });
}
//获取部门下拉
export function getAllDepartmentSelect() {
  return request({
    url: "/sysDept/tree2",
    method: "get"
  });
}
//物资分类下拉
export function getMaterialTypeSelect(id) {
  return request({
    url: `/goodsType/findListByPid/${id}`,
    method: "get"
  });
}
//获取项目库下拉
export function getProjectSelect() {
  return request({
    url: "/project/getProjectList",
    method: "get"
  });
}
//获取权限
export function getAllTree() {
  return request({
    url: "/sysMenu/tree",
    method: "get"
  });
}
//上传文件
export function uploads(resType, data) {
  return request({
    url: `/upload/${resType}/files`,
    method: "post",
    data
  });
}
//上传文件
export function regUploads(resType, data) {
  return request({
    url: `/upload/open/${resType}/upload/files`,
    method: "post",
    data
  });
}

//标操作日志
export function purchaseBidLog(data) {
  return request({
    url: `/bid/getBidLog/${data.id}`,
    method: "get",
    params: data
  });
}

//-----------------工作台
//物资
export function findMaterialAgency(data) {
  return request({
    url: `/workbench/findMyPurchasePlan`,
    method: "post",
    data
  });
}

//劳务
export function findLabourAgency(data) {
  return request({
    url: `/workbench/findMyLabourPlan`,
    method: "post",
    data
  });
}
